package com.evil.mi.enums;

import com.evil.mi.enums.base.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * com.evil.mi.enums
 *
 * @author 白雨浓
 * date: 2018/8/20 9:39
 * content:
 */
@Getter
@AllArgsConstructor
public enum VideoImgStateEnum implements BaseEnum {

    INIT(1, "INIT", "初始化"),

    DOWNLOADING(2, "DOWNLOADING", "下载中"),

    FINISH(3, "FINISH", "完成"),

    ERROR(-1, "ERROR", "失败"),

    INVALID(-9, "INVALID", "无效");

    private int index;
    private String code;
    private String msg;


    @Override
    public VideoImgStateEnum getEnumByCode(String code) {
        for (VideoImgStateEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    @Override
    public VideoImgStateEnum getEnumByIndex(int index) {
        for (VideoImgStateEnum value : values()) {
            if (value.getIndex() == index) {
                return value;
            }
        }
        return null;
    }
}
